class Entry < ActiveRecord::Base
  belongs_to :user
  belongs_to :entrytype
  belongs_to :timequaltype
  
  # TODO: add validation for user when we wire that in
  validates_presence_of :occured_at, :timequaltype_id, :entrytype_id, :entrysubtype_id, :entryvalue 
  validates_numericality_of :entryvalue
      
  protected 
  def validate
    errors.add(:entryvalue, "should be greater then zero") unless entryvalue.nil? || entryvalue >= 0.01
  end
end

